#include <cstdio>
#include <algorithm>
using namespace std;
int a[1010],dp[1100],n;
int main()
{
    freopen("lis1.in","r",stdin);
     freopen("lis1.out","w",stdout);
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    int res=0;
    for(int i=0;i<n;i++)
    {
	    dp[i]=1;
	    for(int j=0;j<i;j++)
		    if(a[j]<a[i])
		    	dp[i]=max(dp[i],dp[j]+1);
		 res=max(res,dp[i]);
	 }
    printf("%d",res);
    fclose(stdin);
	 fclose(stdout);
}
